package com.wanxi.test;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class MyDate {
    public static void main(String[] args) {
//        System.out.println(new Date());
//        System.out.println(new Date().toString());
//        Date date = new Date();
//        System.out.println(date.getTime());
//        System.out.println(date.);
//     getYear   1900
//     getMonth   0开始
//        System.out.println(date.getYear() + "/" + date.getMonth() + "/" + date.getDate());
//        System.out.println(getnianyueri("-"));   ;
        String sp = "yyyy年MM月dd hh点mm分ss秒 sss毫秒";
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(sp);
        System.out.println(simpleDateFormat.format(new Date()));
        String aa="2024年05月09 11点09分55秒 055";
        try {
            System.out.println(simpleDateFormat.parse(aa));
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }

    public static String getnianyueri(String s) {
        Date date = new Date();
        return date.getYear() + 1900 + s + (date.getMonth() + 1) + s + date.getDate();
    }
}
